// console.log(requirejs.s.contexts._.config.config,'requirejs')
require.config({
    urlArgs: "v="+requirejs.s.contexts._.config.config.version,
    packages: [],
    //在打包压缩时将会把include中的模块合并到主文件中
    include: [],
    paths: {
        // 以下的包从bower的libs目录加载
        'jquery': '/app/muadmin/libs/jquery/dist/jquery.min',
        'layer': '/app/muadmin/libs/layer/layer',
        'vue': '/app/muadmin/libs/vue/3/vue',
        'ELEMENT':"/app/muadmin/libs/element-plus/index.full",
        'ELEMENTICON':"/app/muadmin/libs/element-plus/icon",
        "ELEMENTCN":"/app/muadmin/libs/element-plus/zh-cn",
        "common":"/app/muadmin/libs/common/common",
        "Promise":"/app/muadmin/libs/common/promise",
        "MuTreeSelect":"/app/muadmin/libs/common/element_component/mu-tree-select",
        "MenuItem":"/app/muadmin/libs/common/element_component/menu-item",
        "MuShowImg":"/app/muadmin/libs/common/element_component/mu-show-img",
        "MuTreeInput":"/app/muadmin/libs/common/element_component/mu-tree-input",
        "MuFileUpload":"/app/muadmin/libs/common/element_component/mu-file-upload",
        "MuAvatarUpload":"/app/muadmin/libs/common/element_component/mu-avatar-upload",
        "MuAvatarUploads":"/app/muadmin/libs/common/element_component/mu-avatar-uploads",
        "MuCascader":"/app/muadmin/libs/common/element_component/mu-cascader",
        "MuIcon":"/app/muadmin/libs/common/element_component/mu-icon",
        "MuForm":"/app/muadmin/libs/common/element_component/src/mu-form",
        "NumberRange":"/app/muadmin/libs/common/element_component/number-range",
        "KeyValue":"/app/muadmin/libs/common/element_component/key-value",
        "echarts":"/app/muadmin/libs/echarts/echarts.min",
        "mutable":"/app/muadmin/libs/common/components/mutable",
        "muform":"/app/muadmin/libs/common/components/muform",
        "WangEditor":"/app/muadmin/libs/editor/wangEditor.min",

    },
    // shim依赖配置
    shim: {
        'vue':{
            exports:"Vue"
        },
        'layer':{
            deps:[
                '/app/muadmin/libs/layer/css/layer.css'
            ]
        },
        'ELEMENT':{
            deps:[
                'vue',
                '/app/muadmin/libs/element-plus/index.css'
            ]
        },
        "ELEMENTICON":{
            deps:[
                'vue',
                'ELEMENT'
            ]
        },
        "ELEMENTCN":{
            deps:[
                'vue',
                'ELEMENT'
            ]
        },
        "common":{
            deps:[
                'vue',
                'ELEMENT',
                'Promise'
            ]
        },
        "MuTreeSelect":{
            deps:[
                'vue',
                'ELEMENT'
            ]
        },
        "MenuItem":{
            deps:[
                'vue',
                'ELEMENT',
                'ELEMENTICON'
            ]
        },
        "KeyValue":{
            deps:[
                'vue',
                'ELEMENT'
            ]
        },
        "mutable":{
            deps:[
                'vue',
                'ELEMENT'
            ]
        },
        "muform":{
            deps:[
                'vue',
                'ELEMENT'
            ]
        },
        "WangEditor":{
            deps:[
                'vue',
                'ELEMENT',
                '/app/muadmin/libs/editor/style.css'
            ],

        }
    },
    baseUrl: '/app/muadmin/assets/js/', //资源基础路径
    waitSeconds: 60,
    charset: 'utf-8' // 文件编码
});

require(['jquery'], function ($) {
    // console.log( requirejs.s.contexts._.config,'ccccccccccccc')
    //初始配置
    var Config = requirejs.s.contexts._.config.config;
    // console.log(Config)
    //将Config渲染到全局
    window.Config = Config;
    // 配置语言包的路径
    var paths = {};
    // paths['lang'] = Config.moduleurl + '/ajax/lang?callback=define&controllername=' + Config.controllername + '&lang=' + Config.language + '&v=' + Config.site.version;
    // console.log(Config,'pppppppppppppppppp')
    // 避免目录冲突
    // paths['backend/'] = 'admin';
    // console.log(paths, 'paths')
    console.log(Config,'-------------------------------')
    require.config({paths: paths});
    $(function (){
        // console.log(Config.jsname)
        if(Config.jsname){
            require([Config.jsname], function (Controller) {
                // console.log('Config.jsname加载成功')
                if (Controller.hasOwnProperty(Config.actionname)) {
                    Controller[Config.actionname]();
                } else {
                    if (Controller.hasOwnProperty("_empty")) {
                        Controller._empty();
                    }
                }
            }, function (e) {
                // console.error(e,'errrrrrrrrrrrr');
                // 这里可捕获模块加载的错误
            });
        }
    })
});
